Object.defineProperty(exports, "__esModule", {
    value: !0
});

var e, t = function(e) {
    return e && e.__esModule ? e : {
        default: e
    };
}(require("api")), i = getApp().globalData, o = i.app, n = i.appid, r = function(e) {
    return e.showErrorTip = !1, t.default.v4.weappcard.verifymobile(e);
}, a = {
    changeMobile: r,
    verifyMobile: r,
    create: r,
    getMobile: function(e) {
        return e.showErrorTip = !1, t.default.v4.weapp.wxusermobile(e);
    }
};

exports.default = {
    api: a,
    checkPrepareMobileGet: function(e) {
        var t = this;
        wx.getSystemInfo({
            success: function(i) {
                i.SDKVersion >= "1.2.0" && (e.setData({
                    useMobileGet: !0
                }), t.preLogin());
            }
        });
    },
    preLogin: function() {
        wx.showLoading({
            title: "加载中..."
        }), wx.login({
            success: function(t) {
                return e = t.code;
            },
            complete: wx.hideLoading
        }), setInterval(function() {
            wx.login({
                success: function(t) {
                    return e = t.code;
                }
            });
        }, 27e4);
    },
    handleMobileGet: function(t) {
        return new Promise(function(i, r) {
            /getPhoneNumber:fail/.test(t.errMsg) ? r() : (wx.showLoading({
                title: "获取中...",
                mask: !0
            }), a.getMobile({
                data: {
                    code: e,
                    iv: t.iv,
                    encryptedData: t.encryptedData,
                    app: o,
                    appid: n
                },
                complete: wx.hideLoading
            }).then(i, r));
        });
    }
};